knitr::opts_knit$set(root.dir = '../../../')
library(stringr)
library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

1 Load data

data <- read.table('report/promoter_upstream_downstream_10kb/adultBrain/intersect.FrontalCortexOC.bed.gz', sep = '\t', header = F)

v11.good <- is.na(str_match(data$V14, '[ATGC]'))
v11.strategy1 <- str_match(data$V14, '(.+),.+,.+,.+')
v12.good <- is.na(str_match(data$V15, '[ATGC]'))
v12.strategy1 <- str_match(data$V15, '(.+),.+,.+,.+')
strategy1 <- v11.strategy1
strategy1[v12.good, ] <- v12.strategy1[v12.good, ]
# strategy1 <- str_match(data$V12, '(.+),.+,.+,.+')
strategy1 <- strategy1[, 2]
class(strategy1) <- 'numeric'
data <- data.frame(strategy1 = strategy1, centisnp = data$V7, motif = data$V4, position = data$V2, strand = data$V6)
data <- unique(data)
motifs <- unique(data$motif)

2 Include all motifs

ggplot(data) + geom_point(aes(x = centisnp, y = strategy1)) +
    geom_abline(slope = 1, intercept = 0, color = 'red') +
    ggtitle('All motifs')

for (i in motifs){
    data.sub <- data[data$motif == i, ]
    cat('\n')
    cat("#", paste('Motif', i), "\n")
    # cat("\n")
    print(ggplot(data.sub) + geom_point(aes(x = centisnp, y = strategy1)) +
        geom_abline(slope = 1, intercept = 0, color = 'red'))
    # cat("\n")
    cat("\n")
}

3 Motif M01504

4 Motif M01532

5 Motif PBM0050

6 Motif M00338

7 Motif M00041

8 Motif M01251

9 Motif M01992

10 Motif PBM0114

11 Motif PBM0095

12 Motif MA0119.1

13 Motif M01196

14 Motif M00236

15 Motif M00799

16 Motif PBM0097

17 Motif MA0076.1

18 Motif M01990

19 Motif M01988

20 Motif M01986

21 Motif M01976

22 Motif M00615

23 Motif M01916

24 Motif M01057

25 Motif PBM0054

26 Motif M00740

27 Motif M00806

28 Motif M00193

29 Motif M00916

30 Motif M00513

31 Motif M00017

32 Motif M00179

33 Motif M00178

34 Motif M01863

35 Motif M01862

36 Motif M00981

37 Motif MA0018.2

38 Motif M01861

39 Motif M00917

40 Motif M00691

41 Motif M01054

42 Motif M00307

43 Motif M00942

44 Motif M01187

45 Motif M01186

46 Motif M01208

47 Motif M01243

48 Motif M01558

49 Motif M00163

50 Motif M00220

51 Motif M01938

52 Motif M00036

53 Motif M01820

54 Motif M01586

55 Motif M00113

56 Motif M00946

57 Motif M00944

58 Motif M00375

59 Motif M00039

60 Motif M00121

61 Motif M00187

62 Motif M01065

63 Motif M00305

64 Motif M01259

65 Motif M01200

66 Motif MA0088.1

67 Motif M00660

68 Motif M00796

69 Motif M00024

70 Motif M01306

71 Motif M00490

72 Motif PBM0200

73 Motif M00122

74 Motif M01793

75 Motif M01779

76 Motif M01768

77 Motif M00539

78 Motif PBM0013

79 Motif M00119

80 Motif M00371

81 Motif M00370

82 Motif M01742

83 Motif M00652

84 Motif MA0139.1

85 Motif M00687

86 Motif M00288

87 Motif M00279

88 Motif M00280

89 Motif MA0138.2

90 Motif M01256

91 Motif M01028

92 Motif M00325

93 Motif M00256

94 Motif M01827

95 Motif M00422

96 Motif M00171

97 Motif M00651

98 Motif M00303

99 Motif M00281

100 Motif M00424

101 Motif M00007

102 Motif M00210

103 Motif M01796

104 Motif M01971

105 Motif PBM0039

106 Motif PBM0187

107 Motif M00117

108 Motif M00040

109 Motif M01375